Skip to content

New upstream fields#906

Open
BrutuZ wants to merge 2 commits intobeeequeue:mainfrom
BrutuZ:new-fields
Open

New upstream fields#906
BrutuZ wants to merge 2 commits intobeeequeue:mainfrom
BrutuZ:new-fields

Conversation

@BrutuZ
Copy link

@BrutuZ BrutuZ commented Jan 24, 2026

Fribb recently updated the lists generator, this PR aligns the output with the new output

This includes introducing a few new fields, remapping thetvdb that was renamed to tvdb and thus failing to match (removed on rebase after b47c3b6), as well as retiring notify-moe.

I couldn't get .alterTable() to work, hence opting to drop the entire table and recreate it on the DB migration. Didn't seem like much of a problem since it's always repopulated anyway

Before Changes (Live)

{
  "anidb": 5458,
  "anilist": 3390,
  "anime-planet": "amuri-in-star-ocean",
  "anisearch": 4445,
  "imdb": null,
  "kitsu": 2977,
  "livechart": 7110,
  "notify-moe": null,
  "themoviedb": 44298,
  "thetvdb": null,
  "myanimelist": 3390
}
{
  "anidb": 5459,
  "anilist": 3269,
  "anime-planet": "hack-g-u-trilogy",
  "anisearch": 4491,
  "imdb": "tt1164545",
  "kitsu": 2895,
  "livechart": 4721,
  "notify-moe": null,
  "themoviedb": 8864,
  "thetvdb": null,
  "myanimelist": 3269
}

After Changes

{
  "anidb": 5458,
  "anilist": 3390,
  "anime-planet": "amuri-in-star-ocean",
  "anisearch": 4445,
  "imdb": null,
  "kitsu": 2977,
  "livechart": 7110,
  "animenewsnetwork": 8720,
  "themoviedb": 44298,
  "themoviedb-season": 1,
  "thetvdb": 91021,
  "thetvdb-season": 1,
  "myanimelist": 3390,
  "simkl": 40868,
  "animecountdown": 40868,
  "media": "OVA"
}
{
  "anidb": 5459,
  "anilist": 3269,
  "anime-planet": "hack-g-u-trilogy",
  "anisearch": 4491,
  "imdb": "tt1164545",
  "kitsu": 2895,
  "livechart": 4721,
  "animenewsnetwork": 8719,
  "themoviedb": 8864,
  "themoviedb-season": null,
  "thetvdb": 79099,
  "thetvdb-season": null,
  "myanimelist": 3269,
  "simkl": 41283,
  "animecountdown": 41283,
  "media": "MOVIE"
}

@BrutuZ BrutuZ changed the title Update fields from Fribb's anime-lists Fix TVDB and add new upstream fields Jan 31, 2026
@BrutuZ BrutuZ changed the title Fix TVDB and add new upstream fields Add new upstream fields Feb 18, 2026
@BrutuZ
Copy link
Author

BrutuZ commented Feb 18, 2026

Rebased to address merge conflicts from b47c3b6
Ready for review @beeequeue

Copy link
Owner

@beeequeue beeequeue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the effort, but this pr is too big to understand and merge at once. i would recommend splitting it into pieces

  • changing the source json file, explaining the differences between them
  • removal of the old fields
  • adding new fields
    • if any of these are not 1-to-1 mappings they also need new endpoints to fetch them, like tvdb has

i can probably do it if you dont have time. :)

@BrutuZ
Copy link
Author

BrutuZ commented Feb 18, 2026

  • The update to the documentation and tests really blew up the PR's line and file count 😅
  • The JSON has the same structure, just changed it due to the minor savings (a whopping ~50Kb 😆) of the minified / non pretty-print version. Not sure if it was previously available or a new introduction from Fribb's recent update to the generator.
  • The only non-unique fields (seasons and media type) introduced (AFAIK) would make little sense to have the reverse search since there's no relation, unlike the mentioned ones from anime-lists
  • I could also remove the DB migration on dev environment. Was useful while testing the schema updates

@BrutuZ
Copy link
Author

BrutuZ commented Feb 19, 2026

Okay, I did split it in the 3 steps you described, but separate PRs means it will require your intervention because there will be merge conflicts and an extraneous and permanently empty notify-moe column in the database due to the separation of its removal and the new migration for new fields

@BrutuZ BrutuZ changed the title Add new upstream fields New upstream fields and more Feb 19, 2026
@BrutuZ BrutuZ changed the title New upstream fields and more New upstream fields Feb 19, 2026
@BrutuZ
Copy link
Author

BrutuZ commented Feb 19, 2026

Force-pushed only the addition of new fields to this PR since I can only edit the target branch, not the origin.
Should you change your mind and decide the all-in-one approach is easier, I've kept that commit on https://github.com/BrutuZ/arm-server/tree/new-fields-full

Copy link
Owner

@beeequeue beeequeue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for keeping the pr more focused!
i have a lot of comments but they are mainly just to try and increase the code quality, dont take it too harshly. :^)

thetvdb: handleBadValues(entry.tvdb_id),
"thetvdb-season": handleBadValues(entry.season?.tvdb),
simkl: handleBadValues(entry.simkl_id),
media: handleBadValues(entry.type),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure if the media field is relevant as the project is for mapping IDs between services, and media type is something one would know from the source data
it could probably be skipped from the database

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two of the services (TVDB and TMDB) track both Movies and Series, and neither use unique IDs between the media types, meaning the same TMDB/TVDB ID can match a Series and a Movie, completely unrelated to each other.

export const removeDuplicates = (entries: Relation[]): Relation[] => {
const sources = (Object.values(Source) as SourceValue[]).filter(
(source) => source !== Source.TheTVDB && source !== Source.TheMovieDB && source !== Source.IMDB,
const sources = (Object.values(Source) as SourceValue[]).filter((source) =>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably use .includes() or alternatively .has() together with changing NonUniqueFields to a Map for performance

Comment on lines +83 to +84
// eslint-disable-next-line unicorn/prefer-includes
if (NonUniqueFields.some((field) => field === source)) continue
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, why disable the warning about using .includes()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both cases of Skill Issue™, .includes() gave a Type Warning and I couldn't figure out how to address it properly 😅

minimum: 0
maximum: 50000000
example: 1337
animenewsnetwork:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make sure that the order of fields in relations (both in docs and code) are always alphabetical

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe MAL was at the bottom in one place and it threw off my perception of anything else being alphabetized, I only noticed it yesterday with fresh eyes while splitting the PRs

Source.TheMovieDBSeason,
Source.TheTVDB,
Source.TheTVDBSeason,
Source.Simkl,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is simkl unique or not?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know for sure, no experience with the service but it does the whole "Global Movies and TV oh but also Anime" thing, so I preferred to err on the side of caution with non-unique

myanimelist: id++,
simkl: id++,
animecountdown: id++,
media: `${id++}`,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

media cant be a string number

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was weird, but I followed notify.moe's model that is also alphanumerical and since the tests passed I didn't think about it

animenewsnetwork: id++,
"notify-moe": `${id++}`,
themoviedb: id++,
"themoviedb-season": id++,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the seasons should probably be some number between 1-3 rather than an infinitely increasing number, you can hard code it for the tests

animenewsnetwork: id++,
"notify-moe": `${id++}`,
themoviedb: specialId ?? id++,
"themoviedb-season": specialId ?? id++,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, the seasons and media shouldnt be an id

v.string(),
v.regex(/^[\-a-z,]+$/, "Invalid `include` query"),
v.minLength(1),
v.maxLength(100),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this change here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the added fields, the query length surpassed this limit.
IIRC it was a test with the include parameter and every field available

const runUpdateScript = async () => updateRelations()

if (NODE_ENV === "production") {
if (NODE_ENV === Environment.Prod) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure about this, it might be better to just remove the Environment constant altogether in another pr/commit

@BrutuZ
Copy link
Author

BrutuZ commented Feb 19, 2026

I have a lot of comments but they are mainly just to try and increase the code quality, dont take it too harshly. :^)

Don't worry about it, I haven't dabbled with TS much so such comments and pointers are more than welcome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments